package login

import (
	"fmt"
	"golang/database"
)

type Classmates struct {
	Name string
	Sn   string
	Pswd string
}

func Denglu() {
	fmt.Println("请输入你的名字")
	var name string
	fmt.Scanln(&name)
	fmt.Println("请输入你的密码")
	var mima string
	fmt.Scanln(&mima)
	//fmt.Println("你的学号和密码分别是：", name, mima)

	var Dengluyonghu Classmates
	database.DB.Raw("select*from classmates.classmates where name=" + name).Scan(&Dengluyonghu)
	if Dengluyonghu.Pswd == mima {
		fmt.Println("登录成功", Dengluyonghu.Name)
	} else {
		fmt.Println("登录失败，请检查")
	}

}
